import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const files = require.context('.', false, /\.js$/)
const modules = {}

files.keys().forEach(fileName  => {
  if (fileName.indexOf('index.js') ==-1){
    let _fileConfig = files(fileName)
    modules[fileName.replace(/(\.\/|\.js)/g, '')] = _fileConfig.default||_fileConfig
  }  
})
export default new Vuex.Store({
  modules
})
